#!/usr/local/bin/python

import time
import rpyc
from phasedarray import pack_dict

print "Connecting to the local phasedarray server..."
pa = rpyc.connect('localhost',18861)

print "Reading out delays..."
delays = pa.root.delays()
for i,d in delays.iteritems():
    print "Ch "+str(i)+" : "+str(d)

print "Setting the fringe to the right..."
for a in delays:
    if a!=0:
        delays(a) = delays(a) + 10
        print "   set Ch "+str(s)+\
              " delay to",delay(s)
pa.root.setDelays(pack_dict(delays(a)))

fringe_rate = 0.1
n = 0
print "Sweeping fringes through correlator..."
while (fringe_rate*n)<20:
    for a in delays:
        if a!=0:
            delays(a) = delays(a) - fringe_rate*n
            print "   set Ch "+str(s)+\
                  " delay to",delay(s)
            n += 1
            time.sleep(0.5)


